/**
 * 
 */
package com.org.bu.app.jms.listener;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * @author vk
 * 
 */
public class AMQListener implements MessageListener {

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
	 */
	public void onMessage(Message msg) {
		if (msg instanceof TextMessage) {
			try {
				System.out.println("Received msg asynchronously: " + ((TextMessage) msg).getText());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		} else {
			throw new RuntimeException("This message should be of type TextMessage");
		}
	}

}
